\hypertarget{xform_8h}{
\section{C:/Users/Matt/Documents/School/Robotics/zebulon/v2/vision/ext/SIFT/xform.h File Reference}
\label{xform_8h}\index{C:/Users/Matt/Documents/School/Robotics/zebulon/v2/vision/ext/SIFT/xform.h@{C:/Users/Matt/Documents/School/Robotics/zebulon/v2/vision/ext/SIFT/xform.h}}
}
{\ttfamily \#include $<$cxcore.h$>$}\par
\subsection*{Classes}
\begin{DoxyCompactItemize}
\item 
struct \hyperlink{structransac__data}{ransac\_\-data}
\end{DoxyCompactItemize}
\subsection*{Defines}
\begin{DoxyCompactItemize}
\item 
\hypertarget{xform_8h_ab550bb7f206ceacaabccf0a44042fd18}{
\#define {\bfseries RANSAC\_\-ERR\_\-TOL}~3}
\label{xform_8h_ab550bb7f206ceacaabccf0a44042fd18}

\item 
\#define \hyperlink{xform_8h_a072d5d0635988fbb798f32912b3d55ae}{RANSAC\_\-INLIER\_\-FRAC\_\-EST}~0.25
\item 
\#define \hyperlink{xform_8h_a3943434f4eae748e51dc07992521cf02}{RANSAC\_\-PROB\_\-BAD\_\-SUPP}~0.10
\item 
\hypertarget{xform_8h_a14ab99e7e38342c0e0c0e98daf1ae6b0}{
\#define {\bfseries feat\_\-ransac\_\-data}(feat)~( (struct \hyperlink{structransac__data}{ransac\_\-data}$\ast$) (feat)-\/$>$feature\_\-data )}
\label{xform_8h_a14ab99e7e38342c0e0c0e98daf1ae6b0}

\end{DoxyCompactItemize}
\subsection*{Typedefs}
\begin{DoxyCompactItemize}
\item 
typedef CvMat $\ast$($\ast$ \hyperlink{xform_8h_a9bf3bdeb6ee08649f70247ec86aa4867}{ransac\_\-xform\_\-fn} )(CvPoint2D64f $\ast$pts, CvPoint2D64f $\ast$mpts, int n)
\item 
typedef double($\ast$ \hyperlink{xform_8h_ab90db01c423c85ae4ebf0d684840e217}{ransac\_\-err\_\-fn} )(CvPoint2D64f pt, CvPoint2D64f mpt, CvMat $\ast$M)
\end{DoxyCompactItemize}
\subsection*{Functions}
\begin{DoxyCompactItemize}
\item 
CvMat $\ast$ \hyperlink{xform_8h_afda3aa2f1b87efecacc1c67d5e7424c2}{ransac\_\-xform} (struct \hyperlink{structfeature}{feature} $\ast$features, int n, int mtype, \hyperlink{xform_8h_a9bf3bdeb6ee08649f70247ec86aa4867}{ransac\_\-xform\_\-fn} xform\_\-fn, int m, double p\_\-badxform, \hyperlink{xform_8h_ab90db01c423c85ae4ebf0d684840e217}{ransac\_\-err\_\-fn} err\_\-fn, double err\_\-tol, struct \hyperlink{structfeature}{feature} $\ast$$\ast$$\ast$inliers, int $\ast$n\_\-in)
\item 
CvMat $\ast$ \hyperlink{xform_8h_aa294258ca8bc70d38cf1cc7fbc864e8d}{lsq\_\-homog} (CvPoint2D64f $\ast$pts, CvPoint2D64f $\ast$mpts, int n)
\item 
double \hyperlink{xform_8h_a323525d6ce2d21bc668267d5734737cd}{homog\_\-xfer\_\-err} (CvPoint2D64f pt, CvPoint2D64f mpt, CvMat $\ast$H)
\item 
CvPoint2D64f \hyperlink{xform_8h_a9e3482c9323d073713babce91097a139}{persp\_\-xform\_\-pt} (CvPoint2D64f pt, CvMat $\ast$T)
\end{DoxyCompactItemize}


\subsection{Detailed Description}
Functions for computing transforms from image \hyperlink{structfeature}{feature} correspondences

Copyright (C) 2006 Rob Hess $<$\href{mailto:hess@eecs.oregonstate.edu}{\tt hess@eecs.oregonstate.edu}$>$ \begin{DoxyVersion}{Version}
1.1.1-\/20070913 
\end{DoxyVersion}


\subsection{Define Documentation}
\hypertarget{xform_8h_a072d5d0635988fbb798f32912b3d55ae}{
\index{xform.h@{xform.h}!RANSAC\_\-INLIER\_\-FRAC\_\-EST@{RANSAC\_\-INLIER\_\-FRAC\_\-EST}}
\index{RANSAC\_\-INLIER\_\-FRAC\_\-EST@{RANSAC\_\-INLIER\_\-FRAC\_\-EST}!xform.h@{xform.h}}
\subsubsection[{RANSAC\_\-INLIER\_\-FRAC\_\-EST}]{\setlength{\rightskip}{0pt plus 5cm}\#define RANSAC\_\-INLIER\_\-FRAC\_\-EST~0.25}}
\label{xform_8h_a072d5d0635988fbb798f32912b3d55ae}
pessimistic estimate of fraction of inlers for RANSAC \hypertarget{xform_8h_a3943434f4eae748e51dc07992521cf02}{
\index{xform.h@{xform.h}!RANSAC\_\-PROB\_\-BAD\_\-SUPP@{RANSAC\_\-PROB\_\-BAD\_\-SUPP}}
\index{RANSAC\_\-PROB\_\-BAD\_\-SUPP@{RANSAC\_\-PROB\_\-BAD\_\-SUPP}!xform.h@{xform.h}}
\subsubsection[{RANSAC\_\-PROB\_\-BAD\_\-SUPP}]{\setlength{\rightskip}{0pt plus 5cm}\#define RANSAC\_\-PROB\_\-BAD\_\-SUPP~0.10}}
\label{xform_8h_a3943434f4eae748e51dc07992521cf02}
estimate of the probability that a correspondence supports a bad model 

\subsection{Typedef Documentation}
\hypertarget{xform_8h_ab90db01c423c85ae4ebf0d684840e217}{
\index{xform.h@{xform.h}!ransac\_\-err\_\-fn@{ransac\_\-err\_\-fn}}
\index{ransac\_\-err\_\-fn@{ransac\_\-err\_\-fn}!xform.h@{xform.h}}
\subsubsection[{ransac\_\-err\_\-fn}]{\setlength{\rightskip}{0pt plus 5cm}typedef double($\ast$ {\bf ransac\_\-err\_\-fn})(CvPoint2D64f pt, CvPoint2D64f mpt, CvMat $\ast$M)}}
\label{xform_8h_ab90db01c423c85ae4ebf0d684840e217}
Prototype for error functions passed to \hyperlink{xform_8h_afda3aa2f1b87efecacc1c67d5e7424c2}{ransac\_\-xform()}. For a given point, its correspondence, and a transform, functions of this type should compute a measure of error between the correspondence and the point after the point has been transformed by the transform.


\begin{DoxyParams}{Parameters}
\item[{\em pt}]a point \item[{\em mpt}]{\itshape pt's\/} correspondence \item[{\em T}]a transform\end{DoxyParams}
\begin{DoxyReturn}{Returns}
Should return a measure of error between {\itshape mpt\/} and {\itshape pt\/} after {\itshape pt\/} has been transformed by the transform {\itshape T\/}. 
\end{DoxyReturn}
\hypertarget{xform_8h_a9bf3bdeb6ee08649f70247ec86aa4867}{
\index{xform.h@{xform.h}!ransac\_\-xform\_\-fn@{ransac\_\-xform\_\-fn}}
\index{ransac\_\-xform\_\-fn@{ransac\_\-xform\_\-fn}!xform.h@{xform.h}}
\subsubsection[{ransac\_\-xform\_\-fn}]{\setlength{\rightskip}{0pt plus 5cm}typedef CvMat$\ast$($\ast$ {\bf ransac\_\-xform\_\-fn})(CvPoint2D64f $\ast$pts, CvPoint2D64f $\ast$mpts, int n)}}
\label{xform_8h_a9bf3bdeb6ee08649f70247ec86aa4867}
Prototype for transformation functions passed to \hyperlink{xform_8h_afda3aa2f1b87efecacc1c67d5e7424c2}{ransac\_\-xform()}. Functions of this type should compute a transformation matrix given a set of point correspondences.


\begin{DoxyParams}{Parameters}
\item[{\em pts}]array of points \item[{\em mpts}]array of corresponding points; each {\itshape pts\/}\mbox{[}{\itshape i\/}\mbox{]}, {\itshape i=0\/}..{\itshape n-\/1\/}, corresponds to {\itshape mpts\/}\mbox{[}{\itshape i\/}\mbox{]} \item[{\em n}]number of points in both {\itshape pts\/} and {\itshape mpts\/} \end{DoxyParams}
\begin{DoxyReturn}{Returns}
Should return a transformation matrix that transforms each point in {\itshape pts\/} to the corresponding point in {\itshape mpts\/} or NULL on failure. 
\end{DoxyReturn}


\subsection{Function Documentation}
\hypertarget{xform_8h_a323525d6ce2d21bc668267d5734737cd}{
\index{xform.h@{xform.h}!homog\_\-xfer\_\-err@{homog\_\-xfer\_\-err}}
\index{homog\_\-xfer\_\-err@{homog\_\-xfer\_\-err}!xform.h@{xform.h}}
\subsubsection[{homog\_\-xfer\_\-err}]{\setlength{\rightskip}{0pt plus 5cm}double homog\_\-xfer\_\-err (CvPoint2D64f {\em pt}, \/  CvPoint2D64f {\em mpt}, \/  CvMat $\ast$ {\em H})}}
\label{xform_8h_a323525d6ce2d21bc668267d5734737cd}
Calculates the transfer error between a point and its correspondence for a given homography, i.e. for a point $x$, it's correspondence $x'$, and homography $H$, computes $d(x', Hx)^2$. Intended for use as a ransac\_\-err\_\-fn.


\begin{DoxyParams}{Parameters}
\item[{\em pt}]a point \item[{\em mpt}]{\itshape pt's\/} correspondence \item[{\em H}]a homography matrix\end{DoxyParams}
\begin{DoxyReturn}{Returns}
Returns the transfer error between {\itshape pt\/} and {\itshape mpt\/} given {\itshape H\/} 
\end{DoxyReturn}
\hypertarget{xform_8h_aa294258ca8bc70d38cf1cc7fbc864e8d}{
\index{xform.h@{xform.h}!lsq\_\-homog@{lsq\_\-homog}}
\index{lsq\_\-homog@{lsq\_\-homog}!xform.h@{xform.h}}
\subsubsection[{lsq\_\-homog}]{\setlength{\rightskip}{0pt plus 5cm}CvMat$\ast$ lsq\_\-homog (CvPoint2D64f $\ast$ {\em pts}, \/  CvPoint2D64f $\ast$ {\em mpts}, \/  int {\em n})}}
\label{xform_8h_aa294258ca8bc70d38cf1cc7fbc864e8d}
Calculates a least-\/squares planar homography from point correspondeces. Intended for use as a ransac\_\-xform\_\-fn.


\begin{DoxyParams}{Parameters}
\item[{\em pts}]array of points \item[{\em mpts}]array of corresponding points; each {\itshape pts\/}\mbox{[}{\itshape i\/}\mbox{]}, {\itshape i=0\/}..{\itshape n-\/1\/}, corresponds to {\itshape mpts\/}\mbox{[}{\itshape i\/}\mbox{]} \item[{\em n}]number of points in both {\itshape pts\/} and {\itshape mpts\/}; must be at least 4\end{DoxyParams}
\begin{DoxyReturn}{Returns}
Returns the $3 \times 3$ least-\/squares planar homography matrix that transforms points in {\itshape pts\/} to their corresponding points in {\itshape mpts\/} or NULL if fewer than 4 correspondences were provided 
\end{DoxyReturn}
\hypertarget{xform_8h_a9e3482c9323d073713babce91097a139}{
\index{xform.h@{xform.h}!persp\_\-xform\_\-pt@{persp\_\-xform\_\-pt}}
\index{persp\_\-xform\_\-pt@{persp\_\-xform\_\-pt}!xform.h@{xform.h}}
\subsubsection[{persp\_\-xform\_\-pt}]{\setlength{\rightskip}{0pt plus 5cm}CvPoint2D64f persp\_\-xform\_\-pt (CvPoint2D64f {\em pt}, \/  CvMat $\ast$ {\em T})}}
\label{xform_8h_a9e3482c9323d073713babce91097a139}
Performs a perspective transformation on a single point. That is, for a point $(x, y)$ and a $3 \times 3$ matrix $T$ this function returns the point $(u, v)$, where\par


$[x' \ y' \ w']^T = T \times [x \ y \ 1]^T$,\par


and\par


$(u, v) = (x'/w', y'/w')$.

Note that affine transforms are a subset of perspective transforms.


\begin{DoxyParams}{Parameters}
\item[{\em pt}]a 2D point \item[{\em T}]a perspective transformation matrix\end{DoxyParams}
\begin{DoxyReturn}{Returns}
Returns the point $(u, v)$ as above. 
\end{DoxyReturn}
\hypertarget{xform_8h_afda3aa2f1b87efecacc1c67d5e7424c2}{
\index{xform.h@{xform.h}!ransac\_\-xform@{ransac\_\-xform}}
\index{ransac\_\-xform@{ransac\_\-xform}!xform.h@{xform.h}}
\subsubsection[{ransac\_\-xform}]{\setlength{\rightskip}{0pt plus 5cm}CvMat$\ast$ ransac\_\-xform (struct {\bf feature} $\ast$ {\em features}, \/  int {\em n}, \/  int {\em mtype}, \/  {\bf ransac\_\-xform\_\-fn} {\em xform\_\-fn}, \/  int {\em m}, \/  double {\em p\_\-badxform}, \/  {\bf ransac\_\-err\_\-fn} {\em err\_\-fn}, \/  double {\em err\_\-tol}, \/  struct {\bf feature} $\ast$$\ast$$\ast$ {\em inliers}, \/  int $\ast$ {\em n\_\-in})}}
\label{xform_8h_afda3aa2f1b87efecacc1c67d5e7424c2}
Calculates a best-\/fit image transform from image \hyperlink{structfeature}{feature} correspondences using RANSAC.

For more information refer to:

Fischler, M. A. and Bolles, R. C. Random sample consensus: a paradigm for model fitting with applications to image analysis and automated cartography. {\itshape Communications of the ACM, 24\/}, 6 (1981), pp. 381-\/-\/395.


\begin{DoxyParams}{Parameters}
\item[{\em features}]an array of features; only features with a non-\/NULL match of type {\itshape mtype\/} are used in homography computation \item[{\em n}]number of features in {\itshape feat\/} \item[{\em mtype}]determines which of each feature's match fields to use for transform computation; should be one of FEATURE\_\-FWD\_\-MATCH, FEATURE\_\-BCK\_\-MATCH, or FEATURE\_\-MDL\_\-MATCH; if this is FEATURE\_\-MDL\_\-MATCH, correspondences are assumed to be between a feature's img\_\-pt field and its match's mdl\_\-pt field, otherwise correspondences are assumed to be between the the feature's img\_\-pt field and its match's img\_\-pt field \item[{\em xform\_\-fn}]pointer to the function used to compute the desired transformation from \hyperlink{structfeature}{feature} correspondences \item[{\em m}]minimum number of correspondences necessary to instantiate the transform computed by {\itshape xform\_\-fn\/} \item[{\em p\_\-badxform}]desired probability that the final transformation returned by RANSAC is corrupted by outliers (i.e. the probability that no samples of all inliers were drawn) \item[{\em err\_\-fn}]pointer to the function used to compute a measure of error between putative correspondences for a given transform \item[{\em err\_\-tol}]correspondences within this distance of each other are considered as inliers for a given transform \item[{\em inliers}]if not NULL, output as an array of pointers to the final set of inliers \item[{\em n\_\-in}]if not NULL, output as the final number of inliers\end{DoxyParams}
\begin{DoxyReturn}{Returns}
Returns a transformation matrix computed using RANSAC or NULL on error or if an acceptable transform could not be computed. 
\end{DoxyReturn}
